#include<csttdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define LL long long
#define MOD 100003
LL m,n;
LL qpow(LL a,LL b)
{
	LL ans=1;
	for(;b;b>>=1,a=a*a%MOD)
		if(b&1)ans=ans*a%MOD;
	return ans;
}
int main()
{
	scanf("%lld%lld",&m,&n);
	LL ans=(qpow(m,n)%MOD-(m*qpow(m-1,n-1))%MOD)%MOD;
	if(ans<0)ans+=MOD;
	printf("%lld\n",ans);
	return 0;
}
